<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <h1>{{message}}</h1>
</div>
<script src="../../JavaScript/vue.js"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                message: "hello Vue",
                person: {
                    name: "陶品奇",
                    age: 18,
                }
            }
        },
        watch: {
            // 监听简单数据类型的变化
            message(newValue, oldValue) {
                console.log("新值是", newValue)
                console.log("旧值是", oldValue)
            },
            // 监听对象中某个属性的变化
            "person.name"(newValue, oldValue) {
                console.log("新值是", newValue)
                console.log("旧值是", oldValue)
            }
        }
    })
    app.mount("#app")
</script>
</body>
</html>